#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtCharts>
#include <QMap>
#include <QPointF>
#include "ad9910_ctrl.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
    class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void showPoints();
    void resetWavePoints();
    void setDataCache();
    void readDataCache();
    QChart *createWaveChart(const QMap<int, int> &data);

private slots:
    void readData();

    void on_pushButton_IP_connect_clicked();

    void on_pushButton_IP_clear_clicked();

    void on_pushButton_IP_disconnect_clicked();

    void on_pushButton_manualSend_clicked();

    void on_checkBox_PfCfg_ContReCirc_stateChanged(int arg1);

    void on_checkBox_PfCfg_ManTrg_stateChanged(int arg1);

    void on_checkBox_PfCfg_AutoTrg_stateChanged(int arg1);

    void on_pushButton_PfCfg_Trg_clicked();

    void on_pushButton_PfCfg_Send_clicked();

    void on_pushButton_manualSend_Clear_clicked();

    void on_spinBox_PfCfg_SingleStep_valueChanged(int arg1);

    void on_pushButton_WaveCfg_ClearAll_clicked();

    void on_pushButton_WaveCfg_AddPoint_clicked();

    void on_pushButton_WaveCfg_RmLast_clicked();

    void on_pushButton_WaveCfg_RmPrev_clicked();

    void on_pushButton_WaveCfg_SendWaveData_clicked();

    void on_pushButton_WaveCfg_LoadWaveData_clicked();

    void on_pushButton_WaveCfg_SaveWaveData_clicked();

private:
    Ui::MainWindow *ui;
    AD9910_CTRL *ad9910;

    QTimer timer;

    QChartView *waveChartView = Q_NULLPTR;

    QMap<int, int> wavePoints;
    int prevWaveIndex;
};
#endif // MAINWINDOW_H
